##########################################################################################################################
# Predict the malignancy of candidates by different epochs of several models
# Precise reproduction of training might be impossible for some unknown reasons due to cuDNN
# However, we claim that the results would be close to our final submission
# Models are trained on two different versions of candidates, v9 and v15
# Each version of candidates includes stage1 test set optionally, distinguished by "test" or "without_test"
# For each setting, we choose several epochs.
# The results might be better or worse according to the epochs you use.
# The epochs we use in the stage2 are listed in the comment.
# You could predict with one epoch of one model with 4 folds simultaneously by using 4 gpus and runing in the background
##########################################################################################################################

# v9_without_test
## predict for epoch 120
for fold in {0..3}
do
  python vgg13_v9_predict.py -i 0 -w "../../data/tmp_classification_branch2/v9_without_test/fold_${fold}/epoch_120" -o "../../data/tmp_classification_branch2/result/v9_without_test_120" -d "../../data/tmp_classification_branch1/data/kaggle_stage2_candidates_v4.hdf5" -p "../../data/tmp_classification_branch1/data/3dcnn_kaggle_stage2_candidates_v4.pkl" -t 1 -f $fold -g 1
done

# v9_test
## predict for epoch 120
for fold in {0..3}
do
  python vgg13_v9_predict.py -i 1 -w "../../data/tmp_classification_branch2/v9_test/fold_${fold}/epoch_120" -o "../../data/tmp_classification_branch2/result/v9_test_120" -d "../../data/tmp_classification_branch1/data/kaggle_stage2_candidates_v4.hdf5" -p "../../data/tmp_classification_branch1/data/3dcnn_kaggle_stage2_candidates_v4.pkl" -t 1 -f $fold -g 1
done

# v15_without_test
## predict epoch for 90, 97, 99
for epoch in {90,97,99}
do
  for fold in {0..3}
  do
    python vgg13_v15_predict.py -i 0 -w "../../data/tmp_classification_branch2/v15_without_test/fold_${fold}/epoch_${epoch}" -o "../../data/tmp_classification_branch2/result/v15_without_test_${epoch}" -d "../../data/tmp_classification_branch1/data/kaggle_stage2_candidates_v10.hdf5" -p "../../data/tmp_classification_branch1/data/3dcnn_cddv15_v2_kaggle_stage2_candidates_v10.pkl" -t 1 -f $fold -g 1
  done
done

# v15_test
## predict for epoch 90, 100
for epoch in {90,100}
do
  for fold in {0..3}
  do
    python vgg13_v15_predict.py -i 1 -w "../../data/tmp_classification_branch2/v15_test/fold_${fold}/epoch_${epoch}" -o "../../data/tmp_classification_branch2/result/v15_test_${epoch}" -d "../../data/tmp_classification_branch1/data/kaggle_stage2_candidates_v10.hdf5" -p "../../data/tmp_classification_branch1/data/3dcnn_cddv15_v2_kaggle_stage2_candidates_v10.pkl" -t 1 -f $fold -g 1
  done
done
